package cn.hsw.platform.vo;

import cn.hsw.platform.contants.ManageConstant;
import cn.hsw.platform.core.validated.annotations.MustOnly;
import cn.hsw.platform.core.validated.annotations.Password;
import cn.hsw.platform.core.validated.annotations.Phone;
import cn.hsw.platform.core.validated.annotations.UserName;
import cn.hsw.platform.service.UserService;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

/**
 * 用户传输对象，作用于接口接收值
 * @author 李子木
 * @date 2020-10-30
 */
@Data
public class UserVO {

    /**
     * 用户名
     */
    @NotEmpty(message = "user_name is empty")
    @UserName
    @MustOnly(beanClass = UserService.class,method = "findByUserName",message = "该用户名已被注册")
    private String userName;

    /**
     * 手机号
     */
    @NotEmpty(message = "phone is empty")
    @Phone
    @MustOnly(beanClass = UserService.class,method = "findByPhone",message = "该手机号已被注册")
    private String phone;

    /**
     * 密码
     */
    @NotEmpty(message = "password is empty")
    @Password
    private String password;

    /**
     * 昵称
     */
    @NotEmpty(message = "real_name is empty")
    @Size(max = 40,message = "real_name"+ManageConstant.VALIDATION_SIZE_ERROR_RIGHT_MSG)
    private String realName;

    /**
     * 备注
     */
    private String remark;

    @NotEmpty(message = "请选择角色")
    private String rolePid;
}
